<template>
  <view class="uni-common-mt">
  	<uni-segmented-control :current="current" :values="items" :style-type="styleType" :active-color="activeColor"
  		@clickItem="onClickItem" />
  </view>
</template>

<script>
	import {
		UniSegmentedControl, uniCard
	} from '@dcloudio/uni-ui'
export default {
  props: {
    items: Array
  },
	components: {UniSegmentedControl},
  data () {
    return {
      current: 0,
      colorIndex: 0,
      activeColor: '#2896ff',
      styleType: 'button'
    }
  },
	methods: {
		onClickItem(e) {
			if (this.current != e.currentIndex) {
				this.current = e.currentIndex;
				this.$emit('getIndex', this.current)
			}
		}
	}
}
</script>

<style lang="scss">
	.uni-common-mt {
		margin: 6rpx;
	}
	/deep/ .segmented-control__item {
		background-color: #fff;
	}
</style>